/*************************************************************************************
* Test-program for Olimex “STM32-H103”, header board for “STM32F103RBT6”.
* After program start green LED (LED_E) will blink.
*
* Program has to be compiled with optimizer setting "-O0".
* Otherwise delay via while-loop will not work correctly.
*************************************************************************************/
#include <stdio.h>

#include "stm32f10x.h"
#include "led.h"
#include "softdelay.h"
#include "arm_dsp.h"

int main(int argc, char *argv[])
{
    fprintf(stdout, "%d / %f = %f\n", 2, 3.0f, 2 / 3.0f);
    fprintf(_REENT->_stdout, "%d / %f = %f\n", 2, 3.0f, 2 / 3.0f);
    printf("%d / %f = %f\n", 2, 3.0f, 2 / 3.0f);

    // 尝试使用ARM的DSP库
    arm_dsp_test();

	while(1)
	{
		/* GPIO PC13 set, pin=high, LED_E off */
        led_lit();
        printf("led on\n");

		/* delay --> compiler optimizer settings must be "-O0" */
        softdelay_ms(500);

		/* GPIO PC13 reset, pin=low, LED_E on */
        led_ext();
        printf("led off\n");

		/* delay --> compiler optimizer settings must be "-O0" */
        softdelay_ms(500);
	}
    return 0;
}

